<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>javascript 阶段</title>
    <style>
        div {
            width: 100px;
            height: 100px;
            background-color: red;
        }
    </style>
</head>
<body>

    <div></div>

    <script>
        // 设置宽度 200px , 高度300px , 背景蓝色 , 
        // 设置圆角 20px
        // 控制页面元素的样式:
            // dom.style.属性 = 属性值
            // dom.style[属性] = 属性值


        // 获取div
        // var div = document.getElementsByTagName("div");
        var div = document.getElementsByTagName("div")[0];
        console.log(div);


        // 控制div的样式
        // 写法1:
        // div.style.width = "200px";
        // div.style.height = "300px";
        // div.style.backgroundColor = "blue";
        // div.style.borderRadius = "20px";


        // 写法2: (循环对象)
        div.style["width"] = "200px";
        div.style["height"] = "300px";
        div.style["backgroundColor"] = "blue";
        div.style["borderRadius"] = "20px";


    </script>
</body>
</html>